package com.javaee.javaee.dao;

import com.javaee.javaee.bean.Cart;
import org.apache.ibatis.annotations.*;
import org.springframework.data.repository.*;
import java.util.List;

@Mapper
public interface CartMapper {
    @Select("select * from cart")
    List<Cart> findAll();

    @Insert("insert into cart(userno, commodityno, quantity, location, tel, total) values(#{userno}, #{commodityno}, #{quantity}, #{location}, #{tel}, #{total})")
    public int add(Cart cart);

    @Delete("delete from cart where orderno= #{orderno}")
    public int delete(int orderno);

    @Select("select * from cart where orderno= #{orderno}")
    public Cart select(int orderno);

    @Select("select * from cart where userno= #{userno}")
    public Cart select2(String userno);

    @Update("update cart set userno=#{userno}, commodityno=#{commodityno}, quantity=#{quantity}, location=#{location}, tel=#{tel} where orderno=#{orderno}")
    public int update(Cart cart);
}
